home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
007
/
qbtools1.arc
/
AEKEYBOX.BAS
< prev
next >
Wrap
BASIC Source File
|
1987-12-10
|
5KB
|
213 lines
rem $linesize:132
rem $title:'Application Engineer Standard Routines'
rem $subtitle:'AEKEYBOX Select an index key from a scroll box'
' Include the COMMON values
rem $include:'AESHARED.BAS'
' 12-Jan-87, modification .... need to check stack allocation(s)
sub Key.Select.Box(m.len%,qtxt2$(1),opt$,fl%,ky$,mr%,sc%) static
' m.len% Length of display line in view list
' qtxt2$(1) Dialog text displayed in the initial key input block
' opt$ Item returned from KSB
' fl% Index File Number
' ky$ Indexing Parameter
' mr% Indexing Parameter
' sc% Indexing Parameter
if xh%(fl%,2%)=0% then ' No keys in the index
opt$=""
mr%=0%
sc%=0%
exit sub
end if ' xh%(fl%,2%)=0%
redim disp$(5%),mr.temp%(5%),sc.temp%(5%)
redim ttmm$(4%)
ae.sstack%=ae.sstack%+1000%
if ae.sstack%>10000% then
call ae.error("KSB AESTACK Overflow")
end if
high%=(ae.fg%(4%) and 7%)*16%+ae.hg%(4%)
norm%=(ae.bg%(4%) and 7%)*16%+ae.fg%(4%)
uop$="ESC=Exit RETURN=Select F1=Search"
d%=len(uop$)
for j%=1% to 4%
k%=len(dialog$(j%))
if k%>d% then d%=k%
next j%
w%=d%+m.len%+7%
height%=12%
l.marg%=(80%-w%)/2%
t.marg%=(25%-height%)/2%
r.marg%=l.marg%+w%-1%
b.marg%=t.marg%+height%-4%
t.frame$=chr$(214%)+string$((w%-2%),196%)+chr$(183%)
b.frame$=chr$(211%)+string$((w%-2%),196%)+chr$(189%)
redim disp$(5%),mr.temp%(5%),sc.temp%(5%)
redim ttmm$(4%)
redim disp$(5%),mr.temp%(5%),sc.temp%(5%)
redim ttmm$(4%)
horz$=chr$(186%)+string$((w%-2%),32%)+chr$(186%)
call getscreen(ae.screens%(ae.sstack%-999%),t.marg%,l.marg%,b.marg%,r.marg%,0%,0%)
call xqprint(t.frame$,t.marg%,l.marg%,norm%,0%)
call xqprint(b.frame$,b.marg%,l.marg%,norm%,0%)
for j%=t.marg%+1% to b.marg%-1%
call xqprint(horz$,j%,l.marg%,norm%,0%)
next j%
call xqprint(uop$,t.marg%+2%,l.marg%+5%+m.len%,norm%,0%)
for j%=1% to 4%
call xqprint(dialog$(j%),t.marg%+2%+j%,l.marg%+5%+m.len%,norm%,0%)
next j%
call I.Block.Frame(t.marg%+2%,l.marg%+2%,5%,m.len%,1%)
cycle%=0%
i.search%=1%
while cycle%=0%
if i.search%=1% then
y.loc%=1%
ky$=""
du$=""
dn%=0%
for tcycle%=1% to 4%
ttmm$(tcycle%)=dialog$(tcycle%)
dialog$(tcycle%)=qtxt2$(tcycle%)
next tcycle%
call Dialog.Two(ky$,m.len%,du$,dn%)
for tcycle%=1% to 4%
dialog$(tcycle%)=ttmm$(tcycle%)
next tcycle%
call Ctrl.Trim(ky$)
call Bit.Find(fl%,ky$,mrec%,sc%)
if sc% then
disp$(1%)=ky$
mr.temp%(1%)=abs(mrec%) ' Even if not exact.
sc.temp%(1%)=sc%
end if
for j%=2% to 5%
disp$(j%)=string$(m.len%,32%)
mr.temp%(j%)=0%
sc.temp%(j%)=0%
p.mrec%=mrec%
call Bit.Next(fl%,ky$,mrec%,sc%)
if sc% then
if p.mrec%<>mrec% then
disp$(j%)=ky$
mr.temp%(j%)=mrec%
sc.temp%(j%)=sc%
end if
end if
next j%
i.search%=0%
end if
for j%=1% to 5%
if j%=y.loc% then
call xqprint(left$(disp$(j%),m.len%),j%+t.marg%+1%,l.marg%+2%,high%,0%)
end if
if j%<>y.loc% then
call xqprint(left$(disp$(j%),m.len%),j%+t.marg%+1%,l.marg%+2%,norm%,0%)
end if
next j%
call Get.Single(ccode%,typ%)
if typ%=2% then
if ccode%=59% then ' F1, another search
i.search%=1%
end if
if ccode%=72% then 'Up Arrow
y.loc%=y.loc%-1%
if y.loc%=0% then
ky$=disp$(1%)
mrec%=mr.temp%(1%)
sc%=sc.temp%(1%)
p.mrec%=mrec%
call Bit.Prev(fl%,ky$,mrec%,sc%)
if sc% then
if p.mrec%<>mrec% then
for j%=5% to 2% step -1%
disp$(j%)=disp$(j%-1%)
mr.temp%(j%)=mr.temp%(j%-1%)
sc.temp%(j%)=sc.temp%(j%-1%)
next j%
end if
disp$(1%)=ky$
mr.temp%(1%)=mrec%
sc.temp%(1%)=sc%
end if
y.loc%=1%
end if
end if
if ccode%=80% then 'Dn Arrow
if y.loc%<5% then
if sc.temp%(y.loc%+1%)=0% then
y.loc%=y.loc%-1%
end if
end if
y.loc%=y.loc%+1%
if y.loc%=6% then
ky$=disp$(5%)
mrec%=mr.temp%(5%)
sc%=sc.temp%(5%)
p.mrec%=mrec%
call Bit.Next(fl%,ky$,mrec%,sc%)
if sc% then
if mrec%<>p.mrec% then
for j%=1% to 4%
disp$(j%)=disp$(j%+1%)
mr.temp%(j%)=mr.temp%(j%+1%)
sc.temp%(j%)=sc.temp%(j%+1%)
next j%
disp$(5%)=ky$
mr.temp%(5%)=mrec%
sc.temp%(5%)=sc%
end if
end if
y.loc%=5%
end if
end if
end if
if typ%=1% then
if ccode%=13% then ' RETURN key
cycle%=1%
mr%=mr.temp%(y.loc%)
ky$=disp$(y.loc%)
sc%=sc.temp%(y.loc%)
end if
if ccode%=27% then ' ESCAPE key
cycle%=1%
mr%=0%
ky$=""
sc%=0%
end if
end if
wend
opt$=disp$(y.loc%)
call putscreen(ae.screens%(ae.sstack%-999%),t.marg%,l.marg%,b.marg%,r.marg%,0%,0%)
ae.sstack%=ae.sstack%-1000%
erase disp$,mr.temp%,sc.temp%,ttmm$
end sub